#ifndef _DICOM_CLOUD_DOWNLOADER_H_
#define _DICOM_CLOUD_DOWNLOADER_H_

#include <map>
#include <gwbase/base/util.h>
#include <gwbase/base/mutex.h>

namespace dicom {

enum DownloadResult {
  DOWN_SUCCESS,
  DOWN_FAIL,
  DOWN_FILE_DELETED,
  DOWN_AGAIN,
};

struct DownloadTask {
  Mutex mu;
  uint64_t surdoc_key;
  std::string fid;
  std::string target;
  std::string md5;
  std::string md5_from_server;
  DownloadResult result;
  Status error;
};

class CloudDownloader {
 public:
  CloudDownloader();
  ~CloudDownloader();

  Status StartDownloadFile(uint64_t surdoc_key, const std::string& fid,
                           const std::string& target, const std::string& md5,
                           uint64_t* download_id);

  void QueryDownloadStatus(uint64_t download_id, Status* result);

  void RemoveDownloadTask(const std::string& fid);

 private:
};
}

#endif  // _DICOM_CLOUD_DOWNLOADER_H_
